package com.learning.jquizenglish.screen.more;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;

import com.learning.jquizenglish.R;
import com.learning.jquizenglish.common.controller.JQuizHistory;
import com.learning.jquizenglish.common.fragment.JQuizEnglishFragment;
import com.learning.jquizenglish.model.HistoryModel;
import com.learning.jquizenglish.network.JQuizEnglishApi.Level;
import com.learning.jquizenglish.widget.smoothprogressbar.SmoothProgressBar;

public class StatisticScreen extends JQuizEnglishFragment {

	private Spinner spPack;
	private TextView txtTimeTaking;
	private TextView txtAverage;
	private TextView txtScore;
	private SmoothProgressBar smoothProgressBar;
	private Button btnScore;
	private Level highScoreLevel;
	
	@Override
	protected View onCreateContentView(LayoutInflater inflater,
			ViewGroup container) {
		View v = inflater.inflate(R.layout.screen_statistic, container,false);
		txtTimeTaking 	= (TextView) v.findViewById(R.id.tvNumberofTest);
		txtAverage		= (TextView) v.findViewById(R.id.tvAverageScore);
		txtScore		= (TextView) v.findViewById(R.id.tvScore);
		smoothProgressBar = (SmoothProgressBar) v.findViewById(R.id.progressbar);
		initData();
		return v;
	}
	
	private void initData(){
		HistoryModel historyModel = JQuizHistory.getInstance().getHistoryModel();
		if (historyModel!=null) {
			txtTimeTaking.setText("Taken quiz: "+historyModel.total_play+" times");
			txtAverage.setText("Average: "+historyModel.result_percents+"% correct");
			txtScore.setText("Your Score :"+historyModel.result_score +" points");
		}
	}
	
	
}
